package net.jiupinshi.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Despription: 日期工具类
 * @Author: penghui.guo
 * @Date: 2018/10/6 17:24
 */
public class DateUtil {

    public static final String Y_M_D = "yyyy-MM-dd";
    public static final String Y_M_D_H_M_S = "yyyy-MM-dd HH:mm:ss";
    public static final String YMD = "yyyyMMdd";

    public static String currentDateToStr(String format){
        if(StringUtil.isEmpty(format)){
            format = Y_M_D;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(new Date());
    }
}
